home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 52 / Amiga Format AFCD52 (Issue 136, May 2000).iso / -in_the_mag- / program_perfection / vbcc / mystartup / test.c < prev    next >
C/C++ Source or Header  |  2000-03-11  |  1KB  |  66 lines

  1. /*
  2.  * test.c
  3.  *
  4.  * Test code for my fairly minimal VBCC startup code
  5.  *
  6.  * (C) Richard Drummond 1999
  7.  *
  8.  * Please feel free to use and abuse this code in your own
  9.  * programs, but don't blame me if it goes wrong . . .
  10.  *
  11.  * $Id :$
  12.  * $Log: test.c,v $
  13.  * Revision 1.1.1.1  1999/11/10 22:38:29  richard
  14.  * Initial import to cvs
  15.  *
  16.  */
  17.  
  18. #include <dos/dos.h>
  19. #include <proto/dos.h>
  20. #include <stdlib.h>
  21.  
  22.  
  23. VOID
  24. atexit_func( VOID )
  25. {
  26.     Printf( "atexit_func called.\n" );
  27. }
  28.  
  29. VOID
  30. _INIT_6_constructor( VOID )
  31. {
  32.     Printf( "Constructor called.\n" );
  33.     atexit( atexit_func );
  34. }
  35.  
  36. VOID
  37. _EXIT_6_destructor( VOID )
  38. {
  39.     Printf( "Destructor called.\n" );
  40. }
  41.  
  42.  
  43.  
  44. extern APTR WBenchMsg;
  45.  
  46. int
  47. main( char *command, int length )
  48. {
  49.     if( WBenchMsg )
  50.     {
  51.         BPTR StdOut;
  52.  
  53.         if( StdOut = Open( "CON:20/20/200/100/Test/WAIT/CLOSE", MODE_NEWFILE ) )
  54.         {
  55.             FPuts( StdOut, "Started from WB.\n" );
  56.             Close( StdOut );
  57.         }
  58.     }
  59.     else
  60.         Printf( "Started from CLI\nCommand:'%s'\nLength :%ld\n", command, length );
  61.  
  62.     /* just to check the RC is getting through :) */
  63.     return RETURN_FAIL;
  64. }
  65.  
  66.